<!--二维平面类-->
<template>
  <div>
    <FunctionlUnitFrame @closePane="closePane">
      <template slot="title">二维平面</template>
      <template slot="content">
        <!--二维平面类型-->
        <table class="ewpmtypetable " :class="ewpmCategoryNum=='1'?'':'nodisplay'">
          <tr>
            <td :class="ewpmtypenum==1?'ewpmtypetableTdactive':''" @click="ewpmtypeTdC('polyline',1)"><img
              src="../../assets/img/Plotting/polyline.jpg" height="56" width="60" @click="drawLine" id="lineBtn"/></td>
            <td :class="ewpmtypenum==2?'ewpmtypetableTdactive':''" @click="ewpmtypeTdC('polyline',2)"><img
              src="../../assets/img/Plotting/polyline_clampToGround.jpg" height="54" width="60"/></td>
            <td :class="ewpmtypenum==3?'ewpmtypetableTdactive':''" @click="ewpmtypeTdC('polygon',3)"><img
              src="../../assets/img/Plotting/polygon_clampToGround.jpg" height="56" width="60"/></td>
          </tr>
          <tr>
            <td :class="ewpmtypenum==4?'ewpmtypetableTdactive':''" @click="ewpmtypeTdC('polygon',4)"><img
              src="../../assets/img/Plotting/polygon.jpg" height="59" width="60"/></td>
            <td :class="ewpmtypenum==5?'ewpmtypetableTdactive':''" @click="ewpmtypeTdC('polygon',5)"><img
              src="../../assets/img/Plotting/rectangle.jpg" height="56" width="60"/></td>
            <td :class="ewpmtypenum==6?'ewpmtypetableTdactive':''" @click="ewpmtypeTdC('polygon',6)"><img
              src="../../assets/img/Plotting/rectangle_clampToGround.jpg" height="51" width="60"/></td>
          </tr>
        </table>
        <!--二维平面坐标-->
        <table class="ewpmpointtable  " :class="ewpmCategoryNum=='2'?'':'nodisplay'">
          <tr>
            <th colspan="2">-坐标列表</th>
          </tr>
          <tr>
            <td>经度：</td>
            <td>
              <input value="115.56789"/>
            </td>
          </tr>
          <tr>
            <td>维度：</td>
            <td>
              <input value="31.5232"/>
            </td>
          </tr>
          <tr>
            <td colspan="2">
              <el-button type="primary">定位</el-button>
            </td>
          </tr>
        </table>
        <!--二维平面线样式-->
        <table class="ewpmcsstable " :class="ewpmCategoryNum+ewpmtype=='3polyline'?'':'nodisplay'">
          <tr>
            <th colspan="2">-样式信息</th>
          </tr>
          <tr>
            <td>类型</td><td>线</td>
          </tr>
          <tr>
            <td>线型</td>
            <td>
              <el-select placeholder="线型">
                <el-option label="实线" value="1"></el-option>
                <el-option label="虚线" value="2"></el-option>
              </el-select>
            </td>
          </tr>
          <tr>
            <td>颜色</td>
            <td>
              <colorPicker v-model="color" />
            </td>
          </tr>
          <tr>
            <td>宽度</td><td>
            <input value=""/>
          </td>
          <tr>
            <td>是否贴地</td><td>
            <el-switch v-model="switcVlaue" active-color="#13ce66" inactive-color="#ff4949">
            </el-switch>
          </td>
          </tr>
          <tr>
            <td>是否衬色</td><td>
            <el-switch v-model="switcVlaue" active-color="#13ce66" inactive-color="#ff4949">
            </el-switch></td>
          </tr>
          <tr>
            <td>透明度</td><td><el-slider v-model="ewpmOpacity" style="width: 80%"></el-slider></td>
          </tr>
          <tr>
            <th colspan="2">-属性信息</th>
          <tr>
            <td>名称</td><td>
            <input value=""/>
          </td>
          </tr>
          <tr>
            <td>备注</td><td>
            <input value=""/></td>
          </tr>
        </table>
        <!--二维平面面样式-->
        <table class="ewpmcsstable " :class="ewpmCategoryNum+ewpmtype=='3polygon'?'':'nodisplay'">
          <tr>
            <th colspan="2">-样式信息</th>
          </tr>
          <tr>
            <td>类型</td><td>面</td>
          </tr>

          <tr>
            <td>是否填充</td><td>
            <el-switch v-model="switcVlaue" active-color="#13ce66" inactive-color="#ff4949">
            </el-switch>
          </td>
          </tr>
          <tr>
            <td>颜色</td>
            <td>
              <colorPicker v-model="color" />
            </td>
          </tr>
          <tr>
            <td>透明度</td><td><el-slider v-model="ewpmOpacity" style="width: 80%"></el-slider></td>
          </tr>
          <tr>
            <td>是否边框</td><td>
            <el-switch v-model="switcVlaue" active-color="#13ce66" inactive-color="#ff4949">
            </el-switch>
          </td>
          </tr>
          <tr>
            <td>边框透明度</td><td><el-slider v-model="ewpmOpacity" style="width: 80%"></el-slider></td>
          </tr>

          <tr>
            <th colspan="2">-属性信息</th>
          <tr>
            <td>名称</td><td>
            <input value=""/>
          </td>
          </tr>
          <tr>
            <td>备注</td><td>
            <input value=""/></td>
          </tr>
        </table>
        <!--二维平面tab-->
        <table class="ewpmCategory">
          <tr>
            <td @click="ewpmCategoryTdC(1) "  :class="ewpmCategoryNum=='1'?'active':''">类型</td>
            <td @click="ewpmCategoryTdC(2) " :class="ewpmCategoryNum=='2'?'active':''">坐标点</td>
            <td @click="ewpmCategoryTdC(3)" :class="ewpmCategoryNum=='3'?'active':''" >属性</td>
          </tr>
        </table>

      </template>
    </FunctionlUnitFrame>
  </div>
</template>

<script>
  import FunctionlUnitFrame from '@/components/FunctionalUnit/FunctionlUnitFrame'
  export default {
    name: "TwoDimensional",
    data(){
      return {
        ewpmOpacity:100,
        switcVlaue:true,
        ewpmCategoryNum:'1',
        ewpmtype:'img',
        color: '#ff0000',
        ewpmtypenum:0
      }
    },
    components:{
      'FunctionlUnitFrame':FunctionlUnitFrame
    },
    methods:{
      closePane(){
        this.$emit('closePane',false);
      },
      ewpmtypeTdC(type,num){
        this.ewpmtype=type;
        this.ewpmtypenum=num;
      },
      ewpmCategoryTdC(num){
        this.ewpmCategoryNum=num;
      },
      /*画线*/
      drawLine:function () {
        sgworld.AttachEvent("OnLButtonDown",function (x,y) {
          sgworld.Creator.createPolyline([{x,y},{x,y}],sgworld.Creator.createColor(255, 0, 255, 155),"", "", "");
        });
        /*sgworld.AttachEvent("OnFrame",function (x,y){

        });
        sgworld.AttachEvent("OnRButtonDown"),function (x,y){

        }*/
      }
     /* /!*画线*!/
      drawLine:function () {
        var _this = this.$parent.$parent;
        var Cesium = this.$parent.$parent.Cesium;
        var CesiumAPI = this.CesiumAPI;
        var handler = new Cesium.ScreenSpaceEventHandler(this.$parent.$parent.viewer.scene.canvas);
        CesiumAPI.CreateObj.createLine('划线',_this.viewer,Cesium,handler,function (item) {
          console.log(item);
        });
      },*/
   /*   /!*画面*!/
      createPolygon:function () {
        var _this = this.$parent.$parent;
        var Cesium = this.$parent.$parent.Cesium;
        var CesiumAPI = this.CesiumAPI;
        var handler = new Cesium.ScreenSpaceEventHandler(this.$parent.$parent.viewer.scene.canvas);
        CesiumAPI.CreateObj.createPolygon('画面',_this.viewer,Cesium,handler,function (item) {
          console.log(item);
        });

      },*/
    /*  /!*画矩形*!/
      drawRect:function () {
        var _this = this.$parent.$parent;
        var Cesium = this.$parent.$parent.Cesium;
        var CesiumAPI = this.CesiumAPI;
        var handler = new Cesium.ScreenSpaceEventHandler(this.$parent.$parent.viewer.scene.canvas);
        CesiumAPI.CreateObj.drawRect('画矩形',_this,_this.viewer,Cesium,handler,function (item) {
          console.log(item);
        });
      }*/
     /* flyToXYZ:function () {
        this.CesiumAPI.NavigateObj.flyToXYZ(this.$parent.$parent.Cesium,this.$parent.$parent.viewer,86.5, 41.26, 2500000);
      },*/

     /* getFun: function (item){
        this.test = item;
        this.$parent.$parent.viewer.camera.flyTo({
          destination: this.$parent.$parent.Cesium.Cartesian3.fromDegrees(86.5, 41.26, 2500000),
        })
      }*/
    },

  }
</script>

<style scoped>
  .layerpanel{
    width: 320px;
    height: 850px;
    top: 30px;
  }
  .m-colorPicker {
    position: relative;
    text-align: left;
    font-size: 14px;
    display: inline-block;
    z-index: 99;
  }
  table tr td{
    height: 45px;
    font-size: 10px;
    padding-left: 15px;
  }
  table tr td:first-child{
    width: 30%;
  }
  table tr td:last-child{
    width: 70%;
  }
  table tr td input {
    height: 38px;
    background-color:  rgba(45,52,68,.5);
    border: 1px solid rgba(237, 255, 255,1);
    border-radius: 5px;
    width: calc(100% - 5px);
  }
  table tr th{
    height: 30px;
    font-size: 12px;
    font-weight: bold;
    font-family: Arial;
    cursor: pointer;
    text-align: left;
    background-color: rgba(28, 59, 58,.6);
  }
  .el-input__inner {
    -webkit-appearance: none;
    background-color: transparent;
    background-image: none;
    border-radius: 4px;
    border: 1px solid #DCDFE6;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    color: #606266;
    display: inline-block;
    font-size: inherit;
    height: 40px;
    line-height: 40px;
    outline: 0;
    padding: 0 15px;
    -webkit-transition: border-color .2s cubic-bezier(.645,.045,.355,1);
    transition: border-color .2s cubic-bezier(.645,.045,.355,1);
    width: 100%;
  }
  /********点类型样式*********/
  .ewpmtypetable{
    width: 100%;
    border-collapse: separate;
    border-spacing:18px;
  }
  .ewpmtypetable tr td{
    padding-left: 0px;
    text-align: center;
    vertical-align: middle;
    border: 1px solid white;
    width: 33.33%;
    cursor: pointer;
    height: 70px;
  }
  .ewpmtypetable tr td:hover{
    border: 1px solid blue;
  }
  .ewpmtypetableTdactive{
    border: 1px solid blue !important;
  }
  .nodisplay{
    display: none;
  }
  /***********点坐点定位************/
  .ewpmpointtable{
    width: 100%;
    border-collapse: collapse;
  }
  .ewpmpointtable tr th,td{
    vertical-align: middle;
    text-align: left;
    cursor: pointer;
  }
  .ewpmpointtable tr td{
    border: 1px solid rgba(237, 255, 255,1);
  }
  .ewpmpointtable tr td:first-child{
    width: 30%;
  }
  .ewpmpointtable tr td:nth-child(2){
    width: 70%;
  }
  table tr td:nth-child(2) input:focus{
    border: .5px solid blue;
  }
  .ewpmpointtable tr:last-child td{
    height: 100px;
    border: none;
    text-align: center;
  }
  /***********点样式*****************/
  .ewpmcsstable{
    width: 100%;
    border-collapse: collapse;
  }
  .ewpmcsstable tr td{
    text-align: left;
    border: 1px solid rgba(237, 255, 255,1);
  }
  /***********点tab*******************/
  .ewpmCategory{
    /*width: 100%;*/
    height: 40px;
    position: fixed;
    bottom: 0px;
    border-collapse: separate;
    border-spacing: 6px;
  }
  .ewpmCategory tr td{
    padding-left: 0px;
    height: 40px !important;
    width: 60px !important;
    color: #dff0d8;
    cursor: pointer;
    border: 1px solid rgba(45,52,68,1);
    text-align: center;
  }

  .ewpmCategory .nodisplay{
    display: none;
  }
  .ewpmCategory tr td:hover{
    border: 1px solid  gray;
  }
  .active{
    border: 1px solid  gray !important;
  }

  @media screen and (max-width: 500px) {
    .layerpanel{
      width: 200px;
      height: 580px;
      top: 60px !important;
    }
    table tr td img{
      width: 50px;
      height: 50px;
    }

    table tr td{
      height: 25px;
      font-size: 10px;
      padding-left: 5px;
    }
    table tr td input {
      height: 20px;
    }
    /********点类型样式*********/
    .ewpmtypetable{
      width: 100%;
      border-collapse: separate;
      border-spacing:3px;
    }
    .ewpmtypetable tr td{
      padding-left: 0px;
      text-align: center;
      vertical-align: middle;
      border: 1px solid white;
      width: 33.33% !important;
      cursor: pointer;
      height: 50px !important;
    }
    /***********点tab*******************/
    .ewpmCategory{
      /*width: 100%;*/
      height: 40px;
      position: fixed;
      bottom: 0px;
      border-collapse: separate;
      border-spacing: 6px;
    }
    .ewpmCategory tr td{
      height: 20px;
      width: 40px !important;
      color: #dff0d8;
      cursor: pointer;
      border: 1px solid rgba(45,52,68,1);
      text-align: center;
    }
  }
</style>
